-
-
Notifications
You must be signed in to change notification settings - Fork 299
West Midlands | 26-Jan-ITP | Fida H Ali Zada | Sprint 1 | coursework/sprint-1 #929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| // Line 1 is a variable declaration, creating the count variable with an initial value of 0 | ||
| // Describe what line 3 is doing, in particular focus on what = is doing | ||
|
|
||
| // Line 3 is a statement or reassignment. It is changing the value associated with the 'count' variable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Operation like count = count + 1 is very common in programming, and there is a programming term describing such operation.
Can you find out what one-word programming term describes the operation on line 3?
| const dir = ; | ||
| const ext = ; | ||
| const dir = filePath.slice(1, lastSlashIndex); | ||
| const ext = filePath.slice(lastSlashIndex + 5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you express the statement on line 21 so that it works for any path?
For example, "/tmp/my-project/package.json"
|
|
||
| // Math.random() * (maximum - minimum + 1) + minimum; | ||
| // Returns a random number between 1 and 100. | ||
| // The returned value is bigger than (and may possibly equal) 1 and is less than (and may possibly equal) 100; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by "may possibly"? Can the expression ever evaluate to 1 and 100? Yes or No?
| // Including console.log(), there are 5 function calls. | ||
|
|
||
| // b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem? | ||
| // The syntax error was in line 5; a comma was missing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the function call .replaceAll(",", ""), there's a programming term for "," and "" (the values passed into the function). Could you find out what that term is so that you can more precisely describe where the comma is missing?
| // substring() method removes "3" from "399" and returns "99"; | ||
| // padEnd() method pads the "99" and the padding applied is from the end of this string. | ||
| const pence = paddedPenceNumberString | ||
| .substring(paddedPenceNumberString.length - 2) | ||
| .padEnd(2, "0"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we expect this program to work as intended for any valid penceString if we deleted .padEnd(2, "0") from the code?
In other words, do we really need .padEnd(2, "0") in this script?
| What is the return value of `prompt`? | ||
| 'myName No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the question is asking what we can expect the function prompt() to return in general, and not what it returned when you called the function.
| Answer the following questions: | ||
|
|
||
| What does `console` store? | ||
| It stores different data such as, debug, error, info, log, warn, and etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't normally refer to debug an log as data. Can you find a more appropriate term to describe them?
Learners, PR Template
Self checklist
Changelist
I created a new branch 'coursework/sprint-1' from the main branch and completed all the coursework in the sprint-1 folder.